package com.jqq.list_;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 * @author 姬倩倩
 * @version 1.0
 */
public class ListExercise {
    @SuppressWarnings({"all"})
    public static void main(String[] args) {
        List list = new ArrayList();
        for (int i = 0; i < 10; i++) {
            list.add("hello"+ i);
        }
        System.out.println(list);
        list.add(1,"韩顺平教育");
        System.out.println(list);
        System.out.println("index 4 元素："+list.get(4));
        list.remove(5);
        System.out.println(list);
        list.set(6,"666");
        System.out.println(list);
        Iterator iterator = list.iterator();
        System.out.println("===迭代器遍历===");
        while (iterator.hasNext()) {
            Object obj =  iterator.next();
            System.out.print(obj+" ");
        }

    }
}
